/**
 * @Function 归集部门统计枚举
 * @ProjectName credit-data-platform
 * @PackageName com.py.credit.entity.enums
 * @FileName AchievementCountFieldEnum.java
 * @Date 2018年5月9日上午10:50:15
 * @Author Min DongXv
 * @Copyright (c) 2018, 金电联行 All Rights Reserved.
 */
package com.py.credit.entity.enums;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;

import com.py.credit.entity.common.OptionalColumn;

/**
 * @Function 归集部门统计枚举
 * @ClassName AchievementCountFieldEnum
 * @Date 2018年5月9日 上午10:50:15
 * @Author Min DongXv
 */
public enum AchievementDetailsFieldEnum {
	ID("id", "序号", "int", false, "input", true, new HashMap<String, String>(), true,
            true),
    DATE_RANGE("dateRange", "期数", "varchar", true, "input", true, new HashMap<String, String>(), true,
            true),
    RESOURCE_TITLE("resourceTitle", "数据目录", "varchar", true, "input", true, new HashMap<String, String>(), true,
            true),
    FREQUENCY("frequency", "采集周期", "varchar", true, "select", true, new HashMap<String, String>() {
        private static final long serialVersionUID = -6902347697778645226L;

        {
            put("S", "实时");
            put("D", "每日");
            put("W", "每周");
            put("M", "每月");
            put("Q", "每季度");
            put("Y", "每年");
        }
    }, true, true),
    LAST_OPERATOR_NAME("lastOperatorName", "采集人员", "varchar", true, "input", false,
            new HashMap<String, String>(), true, true),
    ADD_TIME("addTime", "添加时间", "datetime", true, "input", true,
            new HashMap<String, String>(), true, true),
    IS_ACHIEVE("isAchieve", "绩效任务", "varchar", true, "select", true, new HashMap<String, String>() {
        private static final long serialVersionUID = 866537282193721388L;

        {
            put("Y", "已完成");
            put("N", "未完成");
            put("R", "进行中");
            put("Z", "暂不处理");
        }
    }, true, true);


    private String colNameEN;
    private String colNameCN;
    private String type;
    private boolean defaultShow;
    private String widget;
    private boolean fuzzy;
    private HashMap<String, String> widgetValue;
    private boolean searchIsShow;
    private boolean advanceConditionShow;

    /**
     * @param colNameEN
     * @param colNameCN
     * @param type
     * @param defaultShow
     * @param widget
     * @param fuzzy
     * @param widgetValue
     * @param searchIsShow
     * @param advanceConditionShow
     */
    private AchievementDetailsFieldEnum(String colNameEN, String colNameCN, String type, boolean defaultShow, String widget,
                                        boolean fuzzy, HashMap<String, String> widgetValue, boolean searchIsShow, boolean advanceConditionShow) {
        this.colNameEN = colNameEN;
        this.colNameCN = colNameCN;
        this.type = type;
        this.defaultShow = defaultShow;
        this.widget = widget;
        this.fuzzy = fuzzy;
        this.widgetValue = widgetValue;
        this.searchIsShow = searchIsShow;
        this.advanceConditionShow = advanceConditionShow;
    }

    /**
     * @return the colNameEN
     */
    public String getColNameEN() {
        return colNameEN;
    }

    /**
     * @param colNameEN the colNameEN to set
     */
    public void setColNameEN(String colNameEN) {
        this.colNameEN = colNameEN;
    }

    /**
     * @return the colNameCN
     */
    public String getColNameCN() {
        return colNameCN;
    }

    /**
     * @param colNameCN the colNameCN to set
     */
    public void setColNameCN(String colNameCN) {
        this.colNameCN = colNameCN;
    }

    /**
     * @return the type
     */
    public String getType() {
        return type;
    }

    /**
     * @param type the type to set
     */
    public void setType(String type) {
        this.type = type;
    }

    /**
     * @return the defaultShow
     */
    public boolean isDefaultShow() {
        return defaultShow;
    }

    /**
     * @param defaultShow the defaultShow to set
     */
    public void setDefaultShow(boolean defaultShow) {
        this.defaultShow = defaultShow;
    }

    /**
     * @return the widget
     */
    public String getWidget() {
        return widget;
    }

    /**
     * @param widget the widget to set
     */
    public void setWidget(String widget) {
        this.widget = widget;
    }

    /**
     * @return the fuzzy
     */
    public boolean isFuzzy() {
        return fuzzy;
    }

    /**
     * @param fuzzy the fuzzy to set
     */
    public void setFuzzy(boolean fuzzy) {
        this.fuzzy = fuzzy;
    }

    /**
     * @return the widgetValue
     */
    public HashMap<String, String> getWidgetValue() {
        return widgetValue;
    }

    /**
     * @param widgetValue the widgetValue to set
     */
    public void setWidgetValue(HashMap<String, String> widgetValue) {
        this.widgetValue = widgetValue;
    }

    /**
     * @return the searchIsShow
     */
    public boolean isSearchIsShow() {
        return searchIsShow;
    }

    /**
     * @param searchIsShow the searchIsShow to set
     */
    public void setSearchIsShow(boolean searchIsShow) {
        this.searchIsShow = searchIsShow;
    }

    /**
     * @return the advanceConditionShow
     */
    public boolean isAdvanceConditionShow() {
        return advanceConditionShow;
    }

    /**
     * @param advanceConditionShow the advanceConditionShow to set
     */
    public void setAdvanceConditionShow(boolean advanceConditionShow) {
        this.advanceConditionShow = advanceConditionShow;
    }

    public static List<OptionalColumn> getOptionalColumns() {

        List<OptionalColumn> OptionalColumns = new ArrayList<OptionalColumn>();
        AchievementDetailsFieldEnum[] values = AchievementDetailsFieldEnum.values();
        for (AchievementDetailsFieldEnum value : values) {
            OptionalColumn optionalColumn = new OptionalColumn(value.getColNameEN(), value.getColNameCN(),
                    value.getType(), value.isDefaultShow(), value.getWidget(), value.isFuzzy(), value.getWidgetValue(),
                    value.isSearchIsShow());
            OptionalColumns.add(optionalColumn);
        }
        return OptionalColumns;
    }

    public static List<String> getDefaultShowColumnEN() {
        List<String> columns = new ArrayList<String>();
        AchievementDetailsFieldEnum[] values = AchievementDetailsFieldEnum.values();
        for (AchievementDetailsFieldEnum value : values) {
            if (value.isDefaultShow()) {
                columns.add(value.getColNameEN());
            }
        }
        return columns;
    }

    public static List<OptionalColumn> getAdvancedConditionColumns() {
        List<OptionalColumn> OptionalColumns = new ArrayList<OptionalColumn>();
        AchievementDetailsFieldEnum[] values = AchievementDetailsFieldEnum.values();
        for (AchievementDetailsFieldEnum value : values) {
            if (value.isAdvanceConditionShow()) {
                OptionalColumn optionalColumn = new OptionalColumn(value.getColNameEN(), value.getColNameCN(),
                        value.getType(), value.isDefaultShow(), value.getWidget(), value.isFuzzy(),
                        value.getWidgetValue(), value.isSearchIsShow());
                OptionalColumns.add(optionalColumn);
            }
        }
        return OptionalColumns;
    }
}
